package com.jscm.openselect;

import com.scm.all.export.SystemUtils;
import com.scm.all.export.WindowOperationUtils;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import org.apache.commons.lang3.StringUtils;

/**
 * 添加偏移条件
 */
public class SelectBtn {
    public static Button button = new Button();
    static {
        init();
    }

    private static void init() {
        button.setText("+");
        button.setPrefWidth(80);
        button.setPrefHeight(40);
        button.setId("SelectBtn");
        button.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                SelectOptionCheckBoxOffset.checkBox.setSelected(true);
                if(SelectOptionCheckBoxOffset.checkBox.isSelected()){
                    if(!StringUtils.equals(SelectTextOffset.textField.getText(),"")){
                        SelectTableView.observableList.add(SelectTextOffset.textField.getText().toUpperCase());
                        SelectTextOffset.textField.setText("");
                    }else {
                        SystemUtils.messageBoxExW(WindowOperationUtils.windowGetHwnd(),"偏移不能为空","温馨提示",0);
                    }

                }else {
                    SystemUtils.messageBoxExW(WindowOperationUtils.windowGetHwnd(),"请先勾选筛查偏移","温馨提示",0);
                }
            }
        });
    }
}
